import yaml
import os


def get_yml_data(file_path: str):
    """读取YAML文件并返回解析后的数据"""
    try:
        with open(file_path, encoding='utf-8') as f:
            return yaml.safe_load(f)
    except Exception as e:
        print(f"无法读取YAML文件 {file_path}: {e}")
        return {}


if __name__ == '__main__':
    config_path = os.path.join('../config', 'Config.yml')
    excel_config_path = os.path.join('../config', 'excelConfig.yml')
    res = get_yml_data(config_path)
    res1 = get_yml_data(excel_config_path)
    print(res)
